# coding: utf8
'''http请求和响应类处理通用方法'''

class PostVerify:
	'''POST提交验证'''
	def __init__(self, request, post_token):
		self.post_token = post_token
		self.session = request.session

	def post_repeat(self):
		'''通过是否存在post_token的session,判断是否重复提交POST'''
		if self.session.get(self.post_token) is not None:	# 首次提交附带post_token
			return False	# 未重复
		return True	# 重复了

	def post_del(self):
		self.session.delete()		# 提交后删掉post_token
